package com.xz.xzutils.settings;

import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.Service;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.util.xmlb.XmlSerializerUtil;
import lombok.Data;
import org.jetbrains.annotations.NotNull;

/**
 * @author DONG.WANG17@HAND-CHINA.COM
 * @since 2025/3/2-03-02 00:11
 */
@Data
@Service
@State(name = "MyPluginState", storages = {@Storage("xz-utils.xml")})
public final class MyPluginState implements PersistentStateComponent<MyPluginState> {
    private String myName;

    public MyPluginState() {
    }

    @Override
    public MyPluginState getState() {
        return this;
    }

    @Override
    public void loadState(@NotNull MyPluginState myPluginState) {
        XmlSerializerUtil.copyBean(myPluginState, this);
    }
}
